# -*- encoding=utf8 -*-
__author__ = "Bryan.Chen"

from airtest.core.api import *

auto_setup(__file__)

from poco.drivers.std import StdPoco
poco = StdPoco()

class TCSPopUpAd:

    def __init__(self):
        print("%s __init__" % (__file__))
    
    def runTest(self, args):
        # try:
        #     poco("LoginScene").wait_for_appearance()
        # except:
        #     print("登录场景加载失败或者已经登录不需要进入场景")
        
        loginScene = poco("LoginScene")
        if not loginScene.exists():
            return True
        
        btnWechat = poco("wx_btn")
        if not btnWechat.exists():
            return True
        
        btnWechat.click([0.5, 0.5])
        
        agreementLayer = poco("AgreementLayer")
        if not agreementLayer.exists():
            return True
        
        btnAccept = agreementLayer.offspring("btn_accept")
        btnAccept.click([0.5, 0.5])

        return True

        
_instance = TCSPopUpAd()
runTest = _instance.runTest